UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZNj9s5q1Usj7Zc3nsdFFHuo4Ks/jVj9i2G51aKkoxFk=' 
WHERE 
  key_id = '3972f2a6220d983533fc3f3da729f5ac11c95285281a6f16f54fd3d114eb3715' 
  AND (
    token = 'ZNj9s5q1Usj7Zc3nsdFFHuo4Ks/jVj9i2G51aKkoxFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041