UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bsq6SAs4+ZQxnJV9jBPTA1bX0fcOBRB9d2fvoiVuJGo='
WHERE
key_id = 'e90c3a4d25e381257f0d2b4e37f68081710fa807988495e4651a7e25cf08fa04'
AND (
token = 'bsq6SAs4+ZQxnJV9jBPTA1bX0fcOBRB9d2fvoiVuJGo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)