UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KhfgBk+MicGQOEbzLeFDp8e6bAkxdXggjCvHXWPWzyA=' 
WHERE 
  key_id = '4e5ef8e1bdee89f42524869de6624cbf16c0cfdde1b7f6eb46a81740d69fb586' 
  AND (
    token = 'KhfgBk+MicGQOEbzLeFDp8e6bAkxdXggjCvHXWPWzyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041