UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qfrnXjcpID67u9vSxyuwI8NHdYWU2++iZOih/Y9IbhU=' 
WHERE 
  key_id = '3b37a1df097213ffc3c44272feab7e0d52da5e5faae9444d48e89032c94b2368' 
  AND (
    token = 'qfrnXjcpID67u9vSxyuwI8NHdYWU2++iZOih/Y9IbhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058