UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+ZYz1rNWBS60JRW5t8PeKWcK/5LXWmkDdzr+bGtQrBQ=' 
WHERE 
  key_id = '45ac001084635bd9830ece003ff7d21123b4f949aeaccfd4a6139e5d5bcc098f' 
  AND (
    token = '+ZYz1rNWBS60JRW5t8PeKWcK/5LXWmkDdzr+bGtQrBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038