UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E8n81C0bhV8eHOH45ZGSqFFI2HQvUctqhPA8n0ih7KU=' 
WHERE 
  key_id = '6dfb1ad13e47b1f0ba0e918b735793ca4952cec065d41e248e4020a839df814b' 
  AND (
    token = 'E8n81C0bhV8eHOH45ZGSqFFI2HQvUctqhPA8n0ih7KU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043