UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H+COjGdSDRaCKibCf90Tz/O+nb37VM6lbLcHegf0n30=' 
WHERE 
  key_id = '700d00abd681b90c5274c7234091585f57b7c60004aa1d6d8419daa2cb11f9a0' 
  AND (
    token = 'H+COjGdSDRaCKibCf90Tz/O+nb37VM6lbLcHegf0n30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028