UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B4vSi29WHsX43dgTftVZaOA+vnSIghElfAm74S7fY1A=' 
WHERE 
  key_id = 'fe7b1d75d9d8cacb902096d7af4ac2cf0c1c773cca86d25d778796a171516458' 
  AND (
    token = 'B4vSi29WHsX43dgTftVZaOA+vnSIghElfAm74S7fY1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033