UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pr1m1JTs+rNcHi1w00zBee2KeFIhKZzKCJwX6T40wDo='
WHERE
key_id = '9ba8d761fbef31773b80f5dd0f6290dbcb4443841975e0be63460893cc3a71a6'
AND (
token = 'pr1m1JTs+rNcHi1w00zBee2KeFIhKZzKCJwX6T40wDo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)