UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gOSDP19AjMLvJXMRZ7F4zSGkNAR8hdFvqH67T3ICdLg='
WHERE
key_id = 'ce6826d14bcb95a83711acac0ebca74f0bc2fc1a394b0cdf118d069c7b2ed122'
AND (
token = 'gOSDP19AjMLvJXMRZ7F4zSGkNAR8hdFvqH67T3ICdLg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)