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