UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2ZEIDK6Qd8JX9DZXcaXghKlQwxf/WWQk1gt4aEma+1E=' 
WHERE 
  key_id = '7b91bf8f8f5a30b270c9acfa5df2e9fed93a8e3c3121c0b6eeff78dd6ecf81bb' 
  AND (
    token = '2ZEIDK6Qd8JX9DZXcaXghKlQwxf/WWQk1gt4aEma+1E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062