UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bJoWC5/SIVxNb3qwVkxaqq8j50D0yQ77WX9lSFObYJc='
WHERE
key_id = '19d247f7b1141cd90ac53e786fcf360b51ab5f53db851551701d145e820af1bb'
AND (
token = 'bJoWC5/SIVxNb3qwVkxaqq8j50D0yQ77WX9lSFObYJc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)