UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ylyn70ppAJLfc/4T+4ZnmydTlQ5qyY1ZyxykqO/lwaM=' 
WHERE 
  key_id = '1846568ad8299b3b7e62887606b0b72a9ba0a2788e74f2ba996bca048c3fcba9' 
  AND (
    token = 'Ylyn70ppAJLfc/4T+4ZnmydTlQ5qyY1ZyxykqO/lwaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051