UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6ChqKiRy3VQgwy1FA9rrGtWS3VwWQd0NPLvwsY22xLE='
WHERE
key_id = '58805c790299b50906560739f7d724dd498d9a6a4da5a89793b8e9bc9221ee55'
AND (
token = '6ChqKiRy3VQgwy1FA9rrGtWS3VwWQd0NPLvwsY22xLE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)