UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BU9JiZhwzSCz7w+gLa/+B/Qmgn6NCNoHZTJDsgWkfLc=' 
WHERE 
  key_id = '683078d415e8b6a105c9c76eb1f1104f51e2505ebf8220e94625904ce7cb616b' 
  AND (
    token = 'BU9JiZhwzSCz7w+gLa/+B/Qmgn6NCNoHZTJDsgWkfLc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064