UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b64fQX86u13jDJ4sf3VaXh0RnBcaHa8qltUDTJLq1MM=' 
WHERE 
  key_id = 'b518052f58387969dbe14073538c13cac83192d9127ea3db6d33304744359729' 
  AND (
    token = 'b64fQX86u13jDJ4sf3VaXh0RnBcaHa8qltUDTJLq1MM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039