UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RZ51qiOpjXm3K5eZ9TvuQ7J6jvGs4H5IPfQUa9cYAhU=' 
WHERE 
  key_id = 'edcc129459df642c754959e504372d8c3c7dbb49a286d2854e6bbf76c24548a3' 
  AND (
    token = 'RZ51qiOpjXm3K5eZ9TvuQ7J6jvGs4H5IPfQUa9cYAhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030