UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0oa9tps0PCSVemplKbsWqRxZRXINUCeQocTGkMk+ns=' 
WHERE 
  key_id = 'b06c1302877285b19ca3accc81eb3f7bb912974f8ee39d9f3a2931c7ee9d4915' 
  AND (
    token = 'O0oa9tps0PCSVemplKbsWqRxZRXINUCeQocTGkMk+ns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019