UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KC51pxJkBps0yJ7djZU21a1dMS6q7saLyHEWi4nIPsY=' 
WHERE 
  key_id = '741e01bd1051cfdd9cf086269d89efa975c651ee86c034515778c76245c7d16f' 
  AND (
    token = 'KC51pxJkBps0yJ7djZU21a1dMS6q7saLyHEWi4nIPsY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037