UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gws8KFFelG46gaIdmbsajxqUFzpuPn3lb+v1P9gmZiE=' 
WHERE 
  key_id = '369458c70261c318648780bae096de7b37520f50c3440b932f780be470749049' 
  AND (
    token = 'gws8KFFelG46gaIdmbsajxqUFzpuPn3lb+v1P9gmZiE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053