UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P1komSoVqmJFCPMjPSF/V98Hxp3PAFS0SwPWxUxLL68=' 
WHERE 
  key_id = 'b356e661df00b74c0eddd107673035639e2092bdce158ca23f30e88e21d6d96e' 
  AND (
    token = 'P1komSoVqmJFCPMjPSF/V98Hxp3PAFS0SwPWxUxLL68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040