UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v0nZGkUYzZkMY5jxOIBhHyU807yaVlXU3mKvyBRKZyM=' 
WHERE 
  key_id = '3289f4b836851276fc639550e82549c950fe0e05189061562512b2e32731e859' 
  AND (
    token = 'v0nZGkUYzZkMY5jxOIBhHyU807yaVlXU3mKvyBRKZyM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028