UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cTe1d+FRmfkEz101LPV9iMV644e1Hb/wDQ2aswNT67A=' 
WHERE 
  key_id = '520fc4e3077ce9edaeeeff71605e6e3f5d807ff4c50bd90ba5dfcfaccdede7ec' 
  AND (
    token = 'cTe1d+FRmfkEz101LPV9iMV644e1Hb/wDQ2aswNT67A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015