UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R8roPbd3gEiRrbDz8lVBaD1x43Y6YbvF85oHS39Udfo='
WHERE
key_id = '824afafc54b7808b9219763d0e14e9545daca4b8c18f5df5e4126b60f002d0e4'
AND (
token = 'R8roPbd3gEiRrbDz8lVBaD1x43Y6YbvF85oHS39Udfo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)