UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cDuu8R4avGsXje9f1U+Yc0NCnYyfJyQpTmxprQr4IbQ=' 
WHERE 
  key_id = 'a781921deabebf8007b876d5f16f516271ec7e08872990c0d9844c3baaf1b3cd' 
  AND (
    token = 'cDuu8R4avGsXje9f1U+Yc0NCnYyfJyQpTmxprQr4IbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018