UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bRYhkvTaRIjVqyrH5UhnWx0CK3Gt87usr5HqIpAkD9s='
WHERE
key_id = '5c6eee5f65819214d6e59be9159158ec0b60975157d604592c40febfacd5040c'
AND (
token = 'bRYhkvTaRIjVqyrH5UhnWx0CK3Gt87usr5HqIpAkD9s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)