UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g5UGhns0P5x+BKockRQkzkj7TS1RmM5Pq3WUZAU774M=' 
WHERE 
  key_id = 'f04e7031605f7e5f0c4aba60eb2addb2f07b66cffdb104b1bb81dbf04282c6e3' 
  AND (
    token = 'g5UGhns0P5x+BKockRQkzkj7TS1RmM5Pq3WUZAU774M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042