UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D4lz7WS0r0gPxkW5dQIBbru+Af7DGEO0SrPR/lixcyE='
WHERE
key_id = 'e7fd13b91dccba414efed590a7553a28a8451babc2c4c086c081887dc86ef5bf'
AND (
token = 'D4lz7WS0r0gPxkW5dQIBbru+Af7DGEO0SrPR/lixcyE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)