UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3NVk5+ET7bx/sgjW/fik/3T2lls4NLePz1tiGVbMO8Y=' 
WHERE 
  key_id = 'f6dd4d702b9d68fc7373ff2f35faf4a2ac3bac542f4a3ae9d09dc7abb5158504' 
  AND (
    token = '3NVk5+ET7bx/sgjW/fik/3T2lls4NLePz1tiGVbMO8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039