UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NUa2XvYGuD+BjMvtrJjjwT8papydF9IBCc3vJFqaByk=' 
WHERE 
  key_id = 'bcf929669f8c0b0d968799ee9da70133d639155f70dfc608bf4515df6a617633' 
  AND (
    token = 'NUa2XvYGuD+BjMvtrJjjwT8papydF9IBCc3vJFqaByk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035