UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iAm6e65/bCyp9Eua2K4+yNlwICM/otI7FAE+RFwrNDs=' 
WHERE 
  key_id = '8d9e11164fb63c5ed7972e1252d3dce764908cf51e381fcb8bdf3709f26e49ca' 
  AND (
    token = 'iAm6e65/bCyp9Eua2K4+yNlwICM/otI7FAE+RFwrNDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034