UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'op7MZvZtCO+n4N955E8TdJAOL1pBolF0X3qzxKd545g=' 
WHERE 
  key_id = '099bb91681485323264e1b08c7cc373150f5eff1999543cda8226455bd24805f' 
  AND (
    token = 'op7MZvZtCO+n4N955E8TdJAOL1pBolF0X3qzxKd545g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025