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