UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EYtES1hvNXaP4nrbFjH+hU1rQ6tWkXYUBb9BuoZGyrI=' 
WHERE 
  key_id = '28be0fc8b7ba28fea802e4b9ea8a88d02ed540c4135d47eccabb146370dd2192' 
  AND (
    token = 'EYtES1hvNXaP4nrbFjH+hU1rQ6tWkXYUBb9BuoZGyrI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020