UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ufCtz8tDJcv7HthuKsWViqxe+dIfHqHXUC8uVw+g5P4=' 
WHERE 
  key_id = '0999f7f3867beffd88591a8f0f6175faa1e868a9f9819125c9d688abb6459f70' 
  AND (
    token = 'ufCtz8tDJcv7HthuKsWViqxe+dIfHqHXUC8uVw+g5P4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035