UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MAdJXciWm8Ajn7Avtu0+Tx740IFtsUydZbHrW6BYJqA='
WHERE
key_id = 'ba0b594d49ea572c2e19b2c74e46971b0d90aacaf1ca7f076112106a5eb425e2'
AND (
token = 'MAdJXciWm8Ajn7Avtu0+Tx740IFtsUydZbHrW6BYJqA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)