UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hviHARnx5pB/OgvFu6XnVO8Rjney2QkQL59OSHTew5I=' 
WHERE 
  key_id = '8b514904efe51706e4b49afec4fa090720bca68a7fba0a0c95e7555c1db39a51' 
  AND (
    token = 'hviHARnx5pB/OgvFu6XnVO8Rjney2QkQL59OSHTew5I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029