UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nhYfUJ1v4micPpXRY0h7Z+uofQJlzq4FjRFezekY9zs=' 
WHERE 
  key_id = '41fa292823aa756e28b303d48c2c22c1ad022f9d23acf502de5d72fc5b538aca' 
  AND (
    token = 'nhYfUJ1v4micPpXRY0h7Z+uofQJlzq4FjRFezekY9zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026