UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8XINIoKruciMsH01jT2GhWA7Th6YwCvRoLXnLRjOyXs='
WHERE
key_id = 'b451d333021a2f46580b16b20ddffd34845475d6ab9efbcb1cd5a4fd03688fb7'
AND (
token = '8XINIoKruciMsH01jT2GhWA7Th6YwCvRoLXnLRjOyXs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)