UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dBOp7OH9A339GgYhlCSIgpeKbByScpowpZBBUZbCL6U=' 
WHERE 
  key_id = 'c89c684b98d26010f5c4c6979895c498433ab2a2d400f9d0d3be20f2a682ebb9' 
  AND (
    token = 'dBOp7OH9A339GgYhlCSIgpeKbByScpowpZBBUZbCL6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050