UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rXMVBuxoiKJwRMudhgyuhWR8oJhkgN/H0T8c5HB1qn0='
WHERE
key_id = '3a7d9b1c6356b04aeff2d35ebd2f570bcc826ac5178041a1cc70291543d5018d'
AND (
token = 'rXMVBuxoiKJwRMudhgyuhWR8oJhkgN/H0T8c5HB1qn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)