UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pKHqxLzqkWMYc1fsAgA8N+he+D65/J46t2GzrjF46uU=' 
WHERE 
  key_id = '87b02d5da30864d7a70ca4f6918524cd8b2357e026bef67a40728e4e072393c4' 
  AND (
    token = 'pKHqxLzqkWMYc1fsAgA8N+he+D65/J46t2GzrjF46uU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043