UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zuuMs6b3kHZhAv9kAv3EE4CZzG1pSKQ7ll6XUYqHS6Y=' 
WHERE 
  key_id = '339d9a2a100fed68854b54064e76f96435da4a504f3cbdbb28c073bbadb51776' 
  AND (
    token = 'zuuMs6b3kHZhAv9kAv3EE4CZzG1pSKQ7ll6XUYqHS6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027