UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X7knEt6U4r4xUa5k3IlHQPpecgFCBIMxFQfC7K/5Ms4='
WHERE
key_id = 'affb03e70c3dcb58eb271d59a3e97e52ac0de1f3c6ab7a2b27cb3fc7c35b3fa3'
AND (
token = 'X7knEt6U4r4xUa5k3IlHQPpecgFCBIMxFQfC7K/5Ms4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)